﻿using System;

using System.Collections.Generic;
using System.Text;
using System.Runtime.InteropServices;

namespace Handrise.Mobile.BasicModal.GPS
{
    internal class GPSAPI
    {
        #region PInvokes to gpsapi.dll
        [DllImport("gpsapi.dll")]
        internal static extern IntPtr GPSOpenDevice(IntPtr hNewLocationData, IntPtr hDeviceStateChange, string szDeviceName, int dwFlags);

        [DllImport("gpsapi.dll")]
        internal static extern int GPSCloseDevice(IntPtr hGPSDevice);

        [DllImport("gpsapi.dll")]
        internal static extern int GPSGetPosition(IntPtr hGPSDevice, IntPtr pGPSPosition, int dwMaximumAge, int dwFlags);

        [DllImport("gpsapi.dll")]
        internal static extern int GPSGetDeviceState(IntPtr pGPSDevice);
        #endregion

        #region PInvokes to coredll.dll
        [DllImport("coredll.dll")]
        internal static extern IntPtr CreateEvent(IntPtr lpEventAttributes, int bManualReset, int bInitialState, StringBuilder lpName);

        [DllImport("coredll.dll")]
        internal static extern int CloseHandle(IntPtr hObject);

        internal const int eventSet = 3;
        [DllImport("coredll.dll")]
        internal static extern int EventModify(IntPtr hHandle, int dwFunc);
        #endregion
    }
}